//
//  AGApp.swift
//  kz
//
//  Created by Wai Yin Chan on 14/9/2017.
//  Copyright © 2017 Tech_001. All rights reserved.
//

import Foundation

class EBetApp : PlatformAppProtocol {
    var gpid = "905647853201"
    var name = "ebet"
    var downloadParam = "ebet_app"
    var url: URL?
    
    var appScheme: String = "manbet"
    var appAction: String = "login"
    var appParam: [String:String] = [:]
    
    func routeGame(_ callback: @escaping (PlatformAppProtocol) -> Void) {
        let defaults = UserDefaults.standard
        let siteid = defaults.string(forKey: DefaultKey.SITE_ID)!
        let username = defaults.string(forKey: DefaultKey.USER_LOGIN_NAME)!
        
        appParam["u"] = "\(siteid)_\(username)"
        appParam["p"] = GlobalInfo.memberInfoData!["token"] as! String
        
        let paramString = RequestHelper.convertGetParams(appParam)
        
        /**** URL Required ****/
        self.url = URL(string: "\(appScheme)://\(appAction)?\(paramString)")
        callback(self)
    }
}
